<?php
	session_start();
	//make a response array to encode json...
	$response = array();
	// include db connect class
	require_once __DIR__ . '/db_connect.php';
	// connecting to db
	$db = new DB_CONNECT();
	if (isset($_GET['callback'])) {
		$cb = null;

		$cb = $_GET['callback'];
		$sql = "SELECT * FROM temp_play_history ORDER BY q_id DESC LIMIT 0, 1";
		$result = mysql_query($sql);
		$data_row = mysql_fetch_array($result);
		
		$response["success"] = 2;
		$response["message"] = "check true/false for current question and provide a new question";
		//still have at least one question, continue to response a question to client
		$response["q_id"] = $data_row[0];
		$response["user"] = $data_row[1];
		$response["true_false_value"] = $data_row[2];
		echo $cb."(".json_encode($response).");";
	}
?>